package com.peanut.baby.mvp.calendar.decorators;

import android.graphics.Bitmap;

import com.prolificinteractive.materialcalendarview.CalendarDay;
import com.prolificinteractive.materialcalendarview.DayViewDecorator;
import com.prolificinteractive.materialcalendarview.DayViewFacade;

import java.util.Collection;
import java.util.HashSet;

/**
 * Created by anonymouslystudio on 2017/7/27.
 */

public class IconDecorator implements DayViewDecorator{
    private Bitmap drawable;
    private final HashSet<CalendarDay> dates;
    public IconDecorator(Bitmap drawable, Collection<CalendarDay> dates) {
        this.drawable = drawable;
        this.dates = new HashSet<>(dates);
    }

    @Override
    public boolean shouldDecorate(CalendarDay day) {
        return dates.contains(day);
    }

    @Override
    public void decorate(DayViewFacade view) {

        view.addSpan(new DrawableSpan(drawable));
    }
}
